class Calculator {
  def calculate(x: Int, y: Int, operator: Char): Any = {
    operator match {
      case '+' => x + y
      case '-' => x - y
      case '*' => x * y
      case '/' =>
        if (y != 0) x.toDouble / y.toDouble
        else "Division by zero"
      case _ => "Invalid operator"
    }
  }
}

// 测试代码
object Main extends App {
  val calculator = new Calculator()
  
  println(calculator.calculate(5, 3, '+')) // Addition
  println(calculator.calculate(5, 3, '-')) // Subtraction
  println(calculator.calculate(5, 3, '*')) // Multiplication
  println(calculator.calculate(5, 3, '/')) // Division
  println(calculator.calculate(5, 0, '/')) // Division by zero
  println(calculator.calculate(5, 3, '%')) // Invalid operator
}
